package com.zq.common.base;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.framework.AopContext;

/**
 * 代理对象管理类
 */
public class ProxyBean<T> {
    protected static final Logger logger = LoggerFactory.getLogger(ProxyBean.class);

    protected T proxy(){
        T bean = null;
        try {
           bean = ((T) AopContext.currentProxy());
           if(bean==null){
                bean= (T) this;
            }
        }catch (IllegalStateException e){
            logger.error(e.getMessage());
        }
        return bean;
    }
}
